#include <bits/stdc++.h>
using namespace std;

int N;
int coord[100][2];
int inttime[100];
char f[100];
typedef struct INS {
    int xy[2];
    int idx[2];
    int time[2];
    bool operator< (const INS &rhs) const {
        return max(time[0], time[1]) < max(rhs.time[0], rhs.time[1]);
    }
}INS;
INS ins[10000];

int main() {
    scanf("%d", &N);
    for (int i = 1; i <=N; i++) {
        getchar();
        scanf("%c %d %d", &f[i], &coord[i][0], &coord[i][1]);
        //printf("%c %d %d\n", f[i], coord[i][0], coord[i][1]);
        inttime[i] = 1000000001;
    }
    int cnt = 0;
    for (int i = 1; i <= N; i++) { 
        for (int j = i+1; j <= N; j++) {
            if (f[i] == 'E') {
                if (coord[i][0] > coord[j][0]) continue;
                if (f[j] == 'E' && coord[i][1] != coord[j][1]) continue;
                if (f[j] == 'N' && coord[i][1] < coord[j][1]) continue;
                if (coord[j][0] - coord[i][0] == coord[i][1] - coord[j][1]) continue;
                ++cnt;
                ins[cnt].xy[0] = coord[j][0];        
                ins[cnt].xy[1] = coord[i][1];
                
                ins[cnt].time[0] = coord[j][0] - coord[i][0];
                ins[cnt].idx[0] = i;

                ins[cnt].time[1] = coord[i][1] - coord[j][1];
                ins[cnt].idx[1] = j;
            }
            if (f[i] == 'N') {
                if (coord[i][1] > coord[j][1]) continue;
                if (f[j] == 'N' && coord[i][0] != coord[j][0]) continue;
                if (f[j] == 'E' && coord[i][0] < coord[j][0]) continue;
                if (coord[j][0] - coord[i][0] == coord[i][1] - coord[j][1]) continue;
                ++cnt;
                ins[cnt].xy[1] = coord[j][1];        
                ins[cnt].xy[0] = coord[i][0];
                
                ins[cnt].time[1] = coord[j][1] - coord[i][1];
                ins[cnt].idx[1] = i;

                ins[cnt].time[0] = coord[i][0] - coord[j][0];
                ins[cnt].idx[0] = j;

                //printf("%d %d:   idx:%d x:%d y:%d time:%d\n", i, j, ins[i].idx, ins[i].xy[0], ins[i].xy[1], ins[i].htime);
            }
        }
    }
    sort(ins + 1, ins + 1 + cnt);
    for (int i = 1; i <= cnt; i++) {
        //printf("idx:%d x:%d y:%d time:%d\n", ins[i].idx, ins[i].xy[0], ins[i].xy[1], ins[i].htime);
        //int idx = ins[i].idx;
        int p = 0, q = 1;

        if (ins[i].time[p] > inttime[ins[i].idx[p]] ||
                ins[i].time[q] > inttime[ins[i].idx[q]]) continue;

        if (ins[i].time[p] > ins[i].time[q]) swap(p, q);

        inttime[ins[i].idx[q]] = min(inttime[ins[i].idx[q]], ins[i].time[q]);

        //if (inttime[idx] == -1) inttime[idx] = htime;
        //inttime[idx] = min(inttime[idx], htime);
    }
    long long ans = 0;
    for (int i = 1; i <= N; i++) {
        if (inttime[i] == 1000000001) {
            printf("Infinity\n");
        } else printf("%lld\n", inttime[i]);
    } 
}